package com.liang.blog.client.user;

import com.liang.blog.common.result.Result;
import com.liang.blog.model.BlogUser;
import com.liang.blog.vo.user.LoginUserVo;
import com.liang.blog.vo.user.RegisterVo;
import com.liang.blog.vo.user.UserInfoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author：YanWenLiang
 * @Date:2023-08-17-20:04
 */
@FeignClient(name = "blog-service-system", contextId="UserFeignClient")
@Component
public interface UserFeignClient {

    @GetMapping("/user/getUserById/{id}")
    Result<UserInfoVo> getUserById(@PathVariable(value = "id") Long id);

    @GetMapping("/user/getLoginUserInfo/{account}")
    Result<LoginUserVo> getLoginUserInfo(@PathVariable(value = "account") String account);

    @GetMapping("/user/setLoginIp/{ip}/{account}")
    void setLoginIp(@PathVariable(value = "ip") String ip, @PathVariable(value = "account") String account);

    @PostMapping("/user/saveUser")
    Result<Boolean> saveUser(@RequestBody RegisterVo registerVo);

    @GetMapping("/user/getUserCount/{account}")
    Result<Integer> getUserCount(@PathVariable(value = "account") String account);

    @GetMapping("/user/public/getUserByEmailCount/{email}")
    Result<Integer> getUserByEmailCount(@PathVariable(value = "email") String email);

    @GetMapping("/user/public/getUserByEmail/{email}")
    Result<BlogUser> getUserByEmail(@PathVariable(value = "email") String email);
}
